//
//  LGInspectionReportHeader.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/9.
//

#import "LGInspectionReportHeader.h"

@interface LGInspectionReportHeader()

/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIButton *dateBtn;

@end

@implementation LGInspectionReportHeader

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.clipsToBounds = YES;
        self.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
        [self addSubview:self.baseView];
        [self.baseView addSubview:self.dateBtn];
    }
    return self;
}

-(void)setDateString:(NSString *)dateString{
    _dateString = dateString;
    [self.dateBtn setTitle:dateString forState:UIControlStateNormal];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:8];
        _baseView.frame = CGRectMake(viewPix(16), viewPix(6), Screen_W-viewPix(32), viewPix(55));
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIButton *)dateBtn{
    if(!_dateBtn){
        UIImage *image = [UIImage imageNamed:@"就诊检查-蓝色"];
        _dateBtn = [UIButton buttonWithTitle:@"" titleFont:LGFontWeight(16, UIFontWeightMedium) normalColor:@"#1F6CC6" selectColor:@"#1F6CC6"];
        [_dateBtn setBackgroundImage:[image resizableImageWithCapInsets:UIEdgeInsetsMake(5, 10, 5, 15)] forState:UIControlStateNormal];
        [_dateBtn setBackgroundImage:[image resizableImageWithCapInsets:UIEdgeInsetsMake(5, 10, 5, 15)] forState:UIControlStateHighlighted];
        _dateBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _dateBtn.frame = CGRectMake(0, viewPix(16), viewPix(152)+iPadMargin(10), viewPix(27));
        _dateBtn.titleEdgeInsets = UIEdgeInsetsMake(0, viewPix(16), 0, 0);

    }
    return _dateBtn;
}

@end
